home *** CD-ROM | disk | FTP | other *** search
-
-
- CHAPTER 11: RUNNING A COMPILED PROGRAM
- There are three possibilities:
-
- WORKBENCH PROGRAMS
- If you compiled your programs using the WB option, you will be able to
- execute it straight from the Workbench by simply clicking on the
- appropriate icon with the mouse. As the program is loading, the mouse
- pointer will flicker continuously. Don't worry if the process takes
- several seconds. AMOS is simply unsquashing the various system routines.
- WARNING! If you click on the icon twice, you could launch another copy of
- the same program!
-
- CLI PROGRAMS
- These programs are created when you select the CLI option from the compiler
- accessory. They can be executed from the CLI by just typing their name.
- For example:
-
- 1>demo
-
- This runs a program called demo from the current disk. If the program you
- wish to run is on another drive, you'll need to include the current
- pathname like so:
-
- 1>Df1:demo
-
- The Amiga treats CLI programs exactly like any other machine code program,
- so they can be called from within batch files or executed automatically on
- startup. See 'CREATING AN AUTOBOOT DISK' for more details.
-
- Normally, AMOS will generate a standard screen for your graphics. This can
- be suppressed with the -S0 option during compilation. You can also include
- parameters. These will be automatically loaded into the reserved variable
- COMMAND LINE$ when your program is initialised. For example:
-
- 1> demo test
-
- executes a compiled demo program called 'Test'. When the program begins
- the parameter test will be placed into the string COMMAND LINE$.
-
- AMOS RUNNABLE PROGRAMS
- These programs can be run directly from the AMOS Basic interpreter, and are
- usually around 40k smaller than the equivalent CLI or Workbench versions.
- If you've a megabyte or more of RAM, you'll often be able to hold both the
- interpreted and compiled versions of the program in memory. This will
- speed up your development process enormously.
- In order to make use of this feature, you first need to compile your
- programs in a special .AMOS format. This can be accomplished from the
- compiler accessory by setting the Type icon to AMOS. You can now load your
- compiled programs and run them straight from the editor. The editor window
- will contain the following lines:
-
- Set Buffer n:Rem where N is the current size of the variable area
- Proc_Complied
- Procedure_Compiled
-
- The procedure_COMPILED is locked and contains your compiled programs. Note
- that the above program definition is taken from a file called
- Header_AMOS.AMOS in the AMOS.System folder. You can edit this file to
- change the name of the compiled procedure to something more exiting. For
- example:
-
- Set Buffer 8
- Proc Amosteriods
- Procedure Amosteriods
-
- WARNING! The procedure definition contained by the header holds a special
- instruction used to execute the compiled program. This should be left
- exactly as it stands. If you try to run the header program from the
- interpreter .AMOS will immediately crash!
- The compiled program is stored in the editor buffer, and is treated
- just like any normal AMOS program. All memory banks are in the standard
- format and can be loaded, saved or grabbed as required. You can even
- execute a compiled program as an accessory. As an example, try compiling
- the new sprite editor on the AMOS compiler disk. Not only is there a
- noticeable increase in the execution speed, but the testing process is
- instantaneous.
-
- EXITING FROM A COMPILED PROGRAM
- The compiled program will automatically return you to the calling
- environment after it has completed successfully. You can however, abort
- from the program at any time by holding down the Control and C keys.
-
- ERROR MESSAGES
- If you've compiled your program with the 'include error messages' or -E1
- option from the command line, a standard AMOS error message will be
- displayed when something goes wrong. The format naturally depends on the
- environment you are using:
-
- WORKBENCH
- The message will be displayed in a small alert box.
-
- CLI
- The error will be returned in the form of a normal CLI message.
-
- AMOS
- The error will be indicated on the INFO line of the AMOS Editor.
-
- Note that the error messages are exactly the same as the interpreted
- versions, except that there are no line numbers. If you want to find the
- exact position at which the error ocurred, you'll need to test the original
- interpreted program from within AMOS Basic. If you've omitted the error
- messages, your program will simply quit and return in the event of an
- error.
-
-